import request from '@/utils/request'

export default {
  getTestcaseList(data, params) {
    return request({
      url: '/functional/testcase/list',
      method: 'post',
      data,
      params
    })
  },
  createTestcase(data) {
    return request({
      url: '/functional/testcase/create',
      method: 'post',
      data
    })
  },
  getTestcaseInfo(data_id, params) {
    return request({
      url: `/functional/testcase/info/${data_id}`,
      method: 'get',
      params: params
    })
  },
  updateTestcase(data) {
    return request({
      url: `/functional/testcase/update/${data.id}`,
      method: 'put',
      data
    })
  },
  getTestcaseVersions(data) {
    return request({
      url: `/functional/testcase/versions/${data.id}`,
      method: 'get'
    })
  },
  changeTestcaseVersion(data) {
    return request({
      url: `/functional/testcase/change_version`,
      method: 'post',
      data
    })
  },
  createNewVersion(data) {
    return request({
      url: `/functional/testcase/new_version`,
      method: 'post',
      data
    })
  },
  deleteTestcaseVersion(data) {
    return request({
      url: '/functional/testcase/delete_version',
      method: 'delete',
      data
    })
  },
  deleteTestcase(data) {
    return request({
      url: '/functional/testcase/delete',
      method: 'delete',
      data
    })
  },
  downTemplateFile() {
    return request({
      url: '/functional/testcase/import/template',
      method: 'get',
      responseType: 'blob'
    })
  }
}
